package day21;

/**
 * 题目： 洗牌
 * 题目链接：https://www.nowcoder.com/practice/5a0a2c7e431e4fbbbb1ff32ac6e8dfa0?tpId=85&&tqId=29848&rp=1&ru=/activity/oj&qru=/ta/2017test/question-ranking
 */

import java.util.Scanner;

public class Main {
    public static void playcards(int[] cards,int n,int k) {
        //洗牌k次
        for (int i = 0; i < k; i++) {
            //洗牌
            int[] newcards = new int[cards.length];
            for (int j = 0; j < n; j++) {
                newcards[2*j] = cards[j];
                newcards[2*j+1] = cards[j+n];
            }
            cards = newcards;
        }
        //按要求打印牌
        print(cards);
    }
    public static void print(int[] cards) {
        for (int i = 0; i < cards.length-1; i++) {
            System.out.print(cards[i]+" ");
        }
        System.out.println(cards[cards.length-1]);
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int group = in.nextInt();   //有几组测试
        for (int i = 0; i < group; i++) {
            int n = in.nextInt();
            int k = in.nextInt();
            int[] cards = new int[2*n];
            for (int j = 0; j < cards.length; j++) {
                cards[j] = in.nextInt();
            }
            playcards(cards,n,k);
        }
    }
}